﻿using System.Windows;
using BaseTypesControlLib.Interfaces;

namespace BaseTypesControlLib.Controls
{
    public class LabelFieldControl:FieldControl, IUseAllWidth
    {
        public LabelFieldControl()
        {
            DefaultStyleKey = typeof(LabelFieldControl);
        }
        
        static LabelFieldControl()
        {
            FrameworkPropertyMetadata fpm=new FrameworkPropertyMetadata(false,
                FrameworkPropertyMetadataOptions.AffectsMeasure |
                FrameworkPropertyMetadataOptions.AffectsArrange);
            UseAllWidthProperty = DependencyProperty.Register("UseAllWidth", typeof(bool),
                typeof(LabelFieldControl), fpm);

            fpm = new FrameworkPropertyMetadata(null,
                FrameworkPropertyMetadataOptions.AffectsMeasure |
                FrameworkPropertyMetadataOptions.AffectsArrange);
            TextProperty = DependencyProperty.Register("Text", typeof(string),
                typeof(LabelFieldControl), fpm);

        }


        public bool UseAllWidth
        {
            get { return (bool)GetValue(UseAllWidthProperty); }
            set { SetValue(UseAllWidthProperty, value); }
        }
        public static readonly DependencyProperty UseAllWidthProperty;


        public string Text
        {
            get { return (string)GetValue(TextProperty); }
            set { SetValue(TextProperty, value); }
        }
        public static readonly DependencyProperty TextProperty;

    }
}
